package com.example.bourse.controller;

import com.example.bourse.filter.ExceptionFilter;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.annotation.Param;
import org.noear.solon.core.handle.ModelAndView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Slf4j
@Api("商品管理")
@Controller
public class DemoController {

    @ApiOperation(value = "测试环境", notes = "测试环境")
    @Mapping("/hello")
    public String hello(@Param(defaultValue = "world") String name) {
        log.error("Hello {}!", name);
        return String.format("Hello %s!", name);
    }

    @ApiOperation(value = "测试环境跳转", notes = "测试环境跳转")
    @Mapping("/hello2")
    public ModelAndView hello2(@Param(defaultValue = "world") String name) {
        log.info("Hello - qiekenao {}!", name);
        return new ModelAndView("hello2.ftl").put("name", name);
    }
}